$themes: (skin_green: ("$select_c": #006f6b,
    "$select_opacity": rgba(0, 111, 107, 0.4),

  ),
  skin_blue: ("$select_c": #4298f3,
    "$select_opacity": rgba(66, 152, 243, 0.4),
  ));

@mixin themeify {

  @each $theme-name,
  $theme-map in $themes {
    //!global 把局部变量强升为全局变量
    $theme-map: $theme-map !global;

    //判断html的data-theme的属性值  #{}是sass的插值表达式
    //& sass嵌套里的父容器标识   @content是混合器插槽，像vue的slot
    [data-theme="#{$theme-name}"] & {
      @content;
    }
  }
}

//声明一个根据Key获取颜色的function
@function themed($key) {
  @return map-get($theme-map, $key);
}

//获取背景颜色
@mixin background_color($color) {
  @include themeify {
    background-color: themed($color);
  }
}

@mixin background_color_shade($color, $percent) {
  @include themeify {
    background-color: shade(themed($color), $percent) !important;
  }
}

@mixin background_color_tint($color, $percent) {
  @include themeify {
    background-color: tint(themed($color), $percent) !important;
  }
}

//获取字体颜色
@mixin font_color($color) {
  @include themeify {
    color: themed($color);
  }
}

//获取边框颜色
@mixin border_color($color) {
  @include themeify {
    border-color: themed($color);
  }
}

//获取边框颜色渐变

@mixin border_color_fade($color) {
  @include themeify {
    border-color: fade-in(themed($color), 0.4);
  }
}

@mixin border_color_shade($color, $percent) {
  @include themeify {
    border-color: shade(themed($color), $percent) !important;
  }
}

@mixin border_color_tint($color, $percent) {
  @include themeify {
    border-color: tint(themed($color), $percent) !important;
  }
}

/// Slightly lighten a color
/// @access public
/// @param {Color} $color - color to tint
/// @param {Number} $percentage - percentage of `$color` in returned color
/// @return {Color}

@function tint($color, $percentage) {
  @return mix(white, $color, $percentage);
}

/// Slightly darken a color
/// @access public
/// @param {Color} $color - color to shade
/// @param {Number} $percentage - percentage of `$color` in returned color
/// @return {Color}

@function shade($color, $percentage) {
  @return mix(black, $color, $percentage);
}